home *** CD-ROM | disk | FTP | other *** search
/ Mac Action 1996 January / mac-action-07.iso / mac / Inside Action / Total Distortion Big Demo / beBeatnk.Dxr / 00386_BeatnikMan.script.ls < prev    next >
Encoding:
Text File  |  1995-06-05  |  7.7 KB  |  286 lines

  1. property TotSingleNouns, TotPlurNouns, TotAdjectives, TotVerbs, TotArticles, TotAdverbs, TotSettings, TotTalkToWho, TotSpecific, TotMusiPaus, MarkSingleNouns, MarkPlurNouns, MarkAdjectives, MarkVerbs, MarkArticles, MarkAdverbs, MarkSettings, MarkTalkToWho, MarkSpecific, MarkMusiPaus, MarkMiniPaus, MaxLines, TotalPoemMarks, CurPoemMark, TotMessage, MarkMessage, SliderBallChan, PoemTextLST, WordTextChan, BigPoemLST, LineMakersLST, PoemDateTime
  2.  
  3. on birth me
  4.   set WordTextChan to 15
  5.   set TotMessage to 3
  6.   set MarkMessage to "Message"
  7.   set BigPoemLST to []
  8.   set SliderBallChan to 9
  9.   set LineMakersLST to []
  10.   add(LineMakersLST, "MakeLineV1")
  11.   add(LineMakersLST, "MakeLineV2")
  12.   add(LineMakersLST, "MakeLineV3")
  13.   add(LineMakersLST, "MakeLineV4")
  14.   add(LineMakersLST, "MakeLineV5")
  15.   add(LineMakersLST, "MakeLineV6")
  16.   add(LineMakersLST, "MakeLineV5")
  17.   add(LineMakersLST, "MakeLineV6")
  18.   set TotSingleNouns to 19
  19.   set TotPlurNouns to 20
  20.   set TotAdjectives to 25
  21.   set TotVerbs to 16
  22.   set TotArticles to 4
  23.   set TotSettings to 6
  24.   set TotTalkToWho to 9
  25.   set TotSpecific to 8
  26.   set TotMusiPaus to 5
  27.   set MarkSingleNouns to "sn"
  28.   set MarkPlurNouns to "pnoun"
  29.   set MarkAdjectives to "adj"
  30.   set MarkVerbs to "b"
  31.   set MarkArticles to "art"
  32.   set MarkSettings to "Setting"
  33.   set MarkTalkToWho to "pad"
  34.   set MarkSpecific to "Specific"
  35.   set MarkMusiPaus to "MusiPaus"
  36.   set MarkMiniPaus to "MiniPaus"
  37.   return me
  38. end
  39.  
  40. on cleanupBeatnik me
  41.   puppetSprite(SliderBallChan, 0)
  42.   puppetSound(0)
  43. end
  44.  
  45. on PrepSlider me
  46.   puppetSprite(SliderBallChan, 1)
  47.   set the constraint of sprite SliderBallChan to SliderBallChan - 1
  48.   set MaxLines to 4
  49. end
  50.  
  51. on DumpPoemToPage me
  52.   set rand to count(PoemTextLST)
  53.   set pos to random(rand)
  54.   set tword1 to getAt(PoemTextLST, pos)
  55.   if (tword1 = RETURN) or (tword1 contains ",") then
  56.     set tword1 to getAt(PoemTextLST, pos - 1)
  57.   end if
  58.   set rand to count(PoemTextLST)
  59.   set pos to random(rand)
  60.   set TWord2 to getAt(PoemTextLST, pos)
  61.   if (TWord2 = RETURN) or (TWord2 contains ",") then
  62.     set TWord2 to getAt(PoemTextLST, pos - 1)
  63.   end if
  64.   put tword1 && TWord2 into field "PoemTitleFLD"
  65.   put PoemDateTime & RETURN & RETURN into field "PoemPageFLD"
  66.   repeat with x = 1 to count(PoemTextLST)
  67.     set tx to getAt(PoemTextLST, x)
  68.     if (tx = ",") or (tx = RETURN) then
  69.       put tx after field "PoemPageFLD"
  70.       next repeat
  71.     end if
  72.     put " " & tx after field "PoemPageFLD"
  73.   end repeat
  74. end
  75.  
  76. on TempStorePoem me
  77.   put RETURN & RETURN & field "PoemTitleFLD" & RETURN & field "PoemPageFLD" & RETURN after field "Saved Poems"
  78.   go("SavedPoems")
  79. end
  80.  
  81. on DragSliderBall me
  82.   puppetSound("PopBeep.001")
  83.   repeat while the mouseDown
  84.     set the locH of sprite SliderBallChan to the mouseH
  85.     if soundBusy(1) then
  86.       nothing()
  87.     else
  88.       puppetSound("Slitter.1")
  89.     end if
  90.     updateStage()
  91.   end repeat
  92.   puppetSound("Beepy02.AIF")
  93.   repeat while soundBusy(1)
  94.     nothing()
  95.   end repeat
  96.   set L to the left of sprite (SliderBallChan - 1)
  97.   set r to the right of sprite (SliderBallChan - 1)
  98.   set range1 to r - L
  99.   set SectionWidth to range1 / 10
  100.   set tempLST to []
  101.   repeat with x = 1 to 10
  102.     add(tempLST, SectionWidth * x)
  103.   end repeat
  104.   set h to the locH of sprite SliderBallChan
  105.   set NormH to h - L
  106.   add(tempLST, NormH)
  107.   sort(tempLST)
  108.   set MaxLines to getPos(tempLST, NormH)
  109. end
  110.  
  111. on MakePoem me
  112.   global BeatnikMan
  113.   set the randomSeed to random(1408227850) + random(1408227850)
  114.   set BigPoemLST to []
  115.   set PoemTextLST to []
  116.   set rand to count(LineMakersLST)
  117.   repeat with x = 1 to MaxLines
  118.     set pos to random(rand)
  119.     set LineMakerDo to getAt(LineMakersLST, pos)
  120.     set DoThis to LineMakerDo && "BeatnikMan"
  121.     do(DoThis)
  122.   end repeat
  123.   set TotalPoemMarks to count(BigPoemLST)
  124.   set CurPoemMark to 1
  125.   set PoemDateTime to the time & ", " & the long date
  126.   cleanupBeatnik(me)
  127.   kickoff(me)
  128. end
  129.  
  130. on kickoff me
  131.   set Mark to getAt(BigPoemLST, CurPoemMark)
  132.   set CurPoemMark to CurPoemMark + 1
  133.   go(Mark)
  134. end
  135.  
  136. on RaveOn me
  137.   set txtcst to the castNum of sprite WordTextChan
  138.   if txtcst = 0 then
  139.     add(PoemTextLST, RETURN)
  140.   else
  141.     if the castType of cast txtcst = #text then
  142.       add(PoemTextLST, the text of cast txtcst)
  143.     end if
  144.   end if
  145.   set Mark to getAt(BigPoemLST, CurPoemMark)
  146.   set CurPoemMark to CurPoemMark + 1
  147.   if CurPoemMark > TotalPoemMarks then
  148.     go("BeatnikFinale")
  149.   else
  150.     go(Mark)
  151.   end if
  152. end
  153.  
  154. on MakeLineV1 me
  155.   set n to random(TotPlurNouns)
  156.   set pnoun1 to MarkPlurNouns & n
  157.   add(BigPoemLST, pnoun1)
  158.   set n to random(TotVerbs)
  159.   set verb1 to MarkVerbs & n
  160.   add(BigPoemLST, verb1)
  161.   set n to random(TotPlurNouns)
  162.   set pnoun2 to MarkPlurNouns & n
  163.   add(BigPoemLST, pnoun2)
  164.   add(BigPoemLST, MarkMiniPaus)
  165.   add(BigPoemLST, pnoun2)
  166.   add(BigPoemLST, verb1)
  167.   set n to random(TotPlurNouns)
  168.   set pnoun3 to MarkPlurNouns & n
  169.   add(BigPoemLST, pnoun3)
  170.   set n to random(TotMusiPaus)
  171.   set MusiPaus1 to MarkMusiPaus & n
  172.   add(BigPoemLST, MusiPaus1)
  173. end
  174.  
  175. on MakeLineV2 me
  176.   set n to random(TotAdjectives)
  177.   set adj1 to MarkAdjectives & n
  178.   add(BigPoemLST, adj1)
  179.   set n to random(TotPlurNouns)
  180.   set pnoun2 to MarkPlurNouns & n
  181.   add(BigPoemLST, pnoun2)
  182.   set n to random(TotVerbs)
  183.   set verb1 to MarkVerbs & n
  184.   add(BigPoemLST, verb1)
  185.   set n to random(TotSingleNouns)
  186.   set pnoun2 to MarkSingleNouns & n
  187.   add(BigPoemLST, pnoun2)
  188.   set n to random(TotPlurNouns)
  189.   set pnoun2 to MarkPlurNouns & n
  190.   add(BigPoemLST, pnoun2)
  191.   set n to random(TotMusiPaus)
  192.   set MusiPaus1 to MarkMusiPaus & n
  193.   add(BigPoemLST, MusiPaus1)
  194. end
  195.  
  196. on MakeLineV3 me
  197.   set n to random(TotSingleNouns)
  198.   set n1 to MarkSingleNouns & n
  199.   add(BigPoemLST, n1)
  200.   set n to random(TotSingleNouns)
  201.   set n2 to MarkSingleNouns & n
  202.   add(BigPoemLST, n2)
  203.   set n to random(TotSingleNouns)
  204.   set n3 to MarkSingleNouns & n
  205.   add(BigPoemLST, n3)
  206.   add(BigPoemLST, MarkMiniPaus)
  207.   set n to random(TotSingleNouns)
  208.   set n4 to MarkSingleNouns & n
  209.   add(BigPoemLST, n4)
  210.   add(BigPoemLST, n3)
  211.   set n to random(TotMusiPaus)
  212.   set MusiPaus1 to MarkMusiPaus & n
  213.   add(BigPoemLST, MusiPaus1)
  214. end
  215.  
  216. on MakeLineV4 me
  217.   set n to random(TotAdjectives)
  218.   set adj1 to MarkAdjectives & n
  219.   add(BigPoemLST, adj1)
  220.   set n to random(TotAdjectives)
  221.   set adj2 to MarkAdjectives & n
  222.   add(BigPoemLST, adj2)
  223.   set n to random(TotSingleNouns)
  224.   set n1 to MarkSingleNouns & n
  225.   add(BigPoemLST, n1)
  226.   set n to random(TotSingleNouns)
  227.   set n2 to MarkSingleNouns & n
  228.   add(BigPoemLST, n2)
  229.   if random(100) < 35 then
  230.     set n to random(TotSettings)
  231.     set s1 to MarkSettings & n
  232.     add(BigPoemLST, s1)
  233.   end if
  234.   set n to random(TotMusiPaus)
  235.   set MusiPaus1 to MarkMusiPaus & n
  236.   add(BigPoemLST, MusiPaus1)
  237. end
  238.  
  239. on MakeLineV5 me
  240.   set n to random(TotArticles)
  241.   set art1 to MarkArticles & n
  242.   add(BigPoemLST, art1)
  243.   set n to random(TotSingleNouns)
  244.   set n1 to MarkSingleNouns & n
  245.   add(BigPoemLST, n1)
  246.   set n to random(TotPlurNouns)
  247.   set pnoun1 to MarkPlurNouns & n
  248.   add(BigPoemLST, pnoun1)
  249.   set n to random(TotVerbs)
  250.   set verb1 to MarkVerbs & n
  251.   add(BigPoemLST, verb1)
  252.   set n to random(TotArticles)
  253.   set art1 to MarkArticles & n
  254.   add(BigPoemLST, art1)
  255.   set n to random(TotAdjectives)
  256.   set adj1 to MarkAdjectives & n
  257.   add(BigPoemLST, adj1)
  258.   set n to random(TotPlurNouns)
  259.   set pnoun1 to MarkPlurNouns & n
  260.   add(BigPoemLST, pnoun1)
  261.   if random(100) < 25 then
  262.     set n to random(TotTalkToWho)
  263.     set t1 to MarkTalkToWho & n
  264.     add(BigPoemLST, t1)
  265.   end if
  266.   set n to random(TotMusiPaus)
  267.   set MusiPaus1 to MarkMusiPaus & n
  268.   add(BigPoemLST, MusiPaus1)
  269. end
  270.  
  271. on MakeLineV6 me
  272.   set n to random(TotAdjectives)
  273.   set adj1 to MarkAdjectives & n
  274.   add(BigPoemLST, adj1)
  275.   set n to random(TotPlurNouns)
  276.   set pnoun1 to MarkPlurNouns & n
  277.   add(BigPoemLST, pnoun1)
  278.   add(BigPoemLST, MarkMiniPaus)
  279.   set n to random(TotMessage)
  280.   set m1 to MarkMessage & n
  281.   add(BigPoemLST, m1)
  282.   set n to random(TotMusiPaus)
  283.   set MusiPaus1 to MarkMusiPaus & n
  284.   add(BigPoemLST, MusiPaus1)
  285. end
  286.